/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author csantos
 */
package simulador;

import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.AffineTransform;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JLabel;

public class Heart extends Point {
	public Scenario scenario;
	private JLabel image = new JLabel();

	public void removeLabel()
	{
		scenario.remove(image);
	}

	Heart(int x, int y, Scenario s) {
		this.x = x;
		this.y = y;
		scenario = s;

		image.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/heartPoint.gif")));
		image.setBounds((int)x-scenario.cellSpace/2, (int)y-scenario.cellSpace/2, scenario.cellSpace, scenario.cellSpace);
		image.setVerticalAlignment(image.TOP);
		image.setHorizontalAlignment(image.LEFT);
		scenario.add(image);
	}
	public void move(int nx, int ny) {
		x = nx;
		y = ny;
		image.setBounds((int)x-scenario.cellSpace/2, (int)y-scenario.cellSpace/2, scenario.cellSpace, scenario.cellSpace);
	}
/*	public void draw(Graphics2D g2d) {
		BufferedImage img = null;
		try {
			img = ImageIO.read(new File("images/heartPoint.gif"));
		} catch (IOException ex) {
			Logger.getLogger(Scenario.class.getName()).log(Level.SEVERE, null, ex);
		}
		AffineTransform origXform = g2d.getTransform();
		AffineTransform newXform = (AffineTransform) (origXform.clone());

		g2d.setTransform(newXform);

		g2d.drawImage(img, x - scenario.cellSpace / 2, y - scenario.cellSpace / 2, null);
		g2d.setTransform(origXform); // Volta o eixo ao estado original
	}*/
}
